package com.uphone.kingmall.adapter;

import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.china.zhuoyue.R;
import com.uphone.kingmall.bean.SendCompanyBean;

/**
 * <pre>
 *     author : radish
 *     e-mail : 15703379121@163.com
 *     time   : 2019/3/22
 *     desc   :
 * </pre>
 */
public class SendCompanyAdapter extends BaseQuickAdapter<SendCompanyBean.SendCosBean, BaseViewHolder> {
    private int catId = -1;
    private int position = -1;

    public SendCompanyAdapter() {
        super(R.layout.kingmall_item_shop_type);
    }

    @Override
    protected void convert(BaseViewHolder helper,SendCompanyBean.SendCosBean item) {
        helper.setText(R.id.tv_item, item.getCompanyName());
        View iv = helper.getView(R.id.iv_item);
        if (item.getId() == catId) {
            iv.setVisibility(View.VISIBLE);
            position = helper.getLayoutPosition();
        } else {
            iv.setVisibility(View.GONE);
        }
    }

    public void setSelectCatId(int catId) {
        this.catId = catId;
        notifyDataSetChanged();
    }

    public int getSelectCatId() {
        return catId;
    }

    public int getSelectPosition() {
        return position;
    }

}
